#! /usr/bin/env python
# _*_ coding: utf-8 _*_

import wx
import table
import wx.grid

data = (("CF", "Bob", "Dernier"), ("2B", "Ryne", "Sandberg"),
        ("LF", "Gary", "Matthews"), ("1B", "Leon", "Durham"),
        ("RF", "Keith", "Moreland"), ("3B", "Ron", "Cey"),
        ("C", "Jody", "Davis"), ("SS", "Larry", "Bowa"),
        ("P", "Rick", "Sutcliffe"))

class SimpleGrid(wx.grid.Grid):

    def __init__(self, parent):
        wx.grid.Grid.__init__(self, parent, wx.NewId())
        entries = []
        for pos, first, last in data:
            entry = table.LineupEntry(pos, first, last)
            entries.append(entry)
        tab = table.LineupTable(entries)

        print tab.GetNumberCols(), tab.GetNumberRows()
        print tab.entries[0].pos
        print tab.entries[0].first
        print tab.entries[0].last

        self.SetTable(tab)

class TestFrame(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, wx.NewId(), 'A Grid', size=(275,275))
        grid = SimpleGrid(self)

class App(wx.App):

    def OnInit(self):
        self.frame = TestFrame(None)
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

if __name__ == "__main__":
    app = App()
    app.MainLoop()
